<?php
class Category_Form_QuickSearchMaidForm extends Ac_Form
{
    private $_preview_link = '';

    private $_category;
    private $_adid;

    protected $elementButtonDecorators = array(
        'ViewHelper',
        'Errors',
    );

    protected $elementDecorators = array(
        'ViewHelper',
        'Errors',
    );

    protected $formDecorators = array(
            'PrepareElements',
            array('ViewScript', array('viewScript' => 'index/customization/maid.phtml'))
    );

    protected $subFormDecorators = array(
        'FormElements',
        array('Description', array('placement' => 'prepend')),
        'fieldset',
    );

    protected $spanDecorators = array(
        'ViewHelper',
        'Errors',
        array('Label', array('placement' => 'prepend')),
        array(array('row' => 'HtmlTag'), array('tag' => 'span')),
    );

    protected $displayGroupDecorators = array(
        'FormElements',
        array('HtmlTag', array('tag' => 'p', 'class' => 'price radio text')),
        array('Description', array('placement' => 'prepend', 'tag' => 'label')),
    );

    protected $elementCheckBoxDecorators = array(
        'ViewHelper',
        'Errors',
        array('Label', array('placement' => 'APPEND')),
        array(array('row' => 'HtmlTag'), array('tag' => 'span')),
    );

    protected $elementMultiCheckBoxDecorators = array(
        'ViewHelper',
        'Errors',
        array('Label', array('placement' => 'APPEND')),
    );

    protected $elementRadioDecorators = array(
        'ViewHelper',
        'Errors',
        array('Label', array('placement' => 'APPEND')),
        array(array('row' => 'HtmlTag'), array('tag' => 'span')),
    );

    protected $elementSelectDecorators = array(
        'ViewHelper',
        'Errors',
       // 'Description'
        array('Label', array()),
    );

    public function __construct($options = array())
    {
        $this->_preview_link = !empty($options['preview_link']) ? $options['preview_link'] : '';
        $this->_category = !empty($options['category']) ? $options['category'] : array();
        $this->_adid = !empty($options['adid']) ? $options['adid'] : array();
        parent::__construct($options);
    }

    public function init()
    {
        parent::init();

        $this->setMethod('get');
        $this->setAction($this->getView()->geturl('regular' ,'search'));

        $element = new Zend_Form_Element_Hidden('adid');
        $element->setValue((string) $this->_adid);
        $element->setDecorators(array(
                'ViewHelper'
            )
        );
        $this->addElement($element);

        //Category
        $this->addElement('hidden', 'small_category_list', array(
            'filters'    => array('StringTrim', 'StringToLower'),
            'validators' => array(
                'Int'
            ),
            'value' => 'domestic-help',
            'disableLoadDefaultDecorators' => true,
            'decorators' => $this->elementDecorators,
            'required'   => true,
        ));


        //nationality
        $this->addElement('select', 'nationality', array(
                    'decorators'   => $this->elementSelectDecorators,
                    'multiOptions' => Model_Listing_Maid::getNationality(),
                )
        );

        //language
        $this->addElement('select', 'language', array(
                    'decorators'   => $this->elementSelectDecorators,
                    'multiOptions' => Model_Listing_Maid::getLanguages(),
                )
        );

        //cooking style
        $this->addElement('select', 'cooking', array(
                    'decorators'   => $this->elementSelectDecorators,
                    'multiOptions' => Model_Listing_Maid::getCookingStyle(),
                )
        );

        //people care and nursing
        $this->addElement('select', 'carenursing', array(
                    'decorators'   => $this->elementSelectDecorators,
                    'multiOptions' => Model_Listing_Maid::getPeopleCareNursingSearch(),
                )
        );
        
        

        $this->addElement('button', 'v', array(
            'required'    => false,
            'ignore'      => true,
            'type'        => 'submit',
            'label'       => 'Search',
            'decorators'  => $this->elementButtonDecorators,
        ));

    }
}